package com.example.kotlindemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import com.example.kotlindemo.databinding.ActivityViewModelModeBinding

class ViewModelModeActivity : AppCompatActivity() {
    lateinit var viewModel: MyViewModel
    private var databinding: ActivityViewModelModeBinding? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        databinding = DataBindingUtil.setContentView(this, R.layout.activity_view_model_mode)
        viewModel = ViewModelProvider(this)[MyViewModel::class.java]
        this.databinding?.data = viewModel
        this.databinding?.lifecycleOwner = this
    }
}

